# 初始化组件
from vocab_processor import NLTKLoader, VocabularyProcessor

loader = NLTKLoader()
processor = VocabularyProcessor(loader)

# 示例输入
chapters = [
    ("Chapter 1", "The runner was running faster in the final race. He had eaten quickly."),
    ("Chapter 2", "Better late than never, but better never late.")
]

# 已知词汇
known_words = {"eat", "quick"}

# 处理文本
result = processor.process_book(chapters, known_words)

# 查看结果
for chapter, words in result.items():
    print(f"\n{chapter}:")
    for word, count, example in words:
        print(f"- {word} (出现{count}次) 例句: {example}")